#!/bin/bash

echo "=== 测试修复效果 ==="

# Create a test script for single interactive session
cat > /tmp/fixes_test_commands << 'EOF'
CREATE DATABASE fixtest;
USE fixtest;
SHOW TABLES;
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50));
DESCRIBE users;
DROP TABLE users;
CREATE TABLE users (id INT PRIMARY KEY, email VARCHAR(100));
DESCRIBE users;
CREATE TABLE test_dup (id INT, id INT, name VARCHAR(50));
quit
EOF

echo "在单个交互式会话中测试修复："
echo "---"
cat /tmp/fixes_test_commands
echo "---"

# Run all commands in a single interactive session with fixed client
./bin/gu_fixed -h localhost -P 7777 -u admin -i < /tmp/fixes_test_commands

# Cleanup
rm -f /tmp/fixes_test_commands

echo "=== 修复效果测试完成 ==="